home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / octa209s.zip / octave-2.09 / src / pt-mvr.h < prev    next >
C/C++ Source or Header  |  1996-10-12  |  4KB  |  175 lines

  1. /*
  2.  
  3. Copyright (C) 1996 John W. Eaton
  4.  
  5. This file is part of Octave.
  6.  
  7. Octave is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU General Public License as published by the
  9. Free Software Foundation; either version 2, or (at your option) any
  10. later version.
  11.  
  12. Octave is distributed in the hope that it will be useful, but WITHOUT
  13. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with Octave; see the file COPYING.  If not, write to the Free
  19. Software Foundation, 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  20.  
  21. */
  22.  
  23. #if !defined (octave_tree_mvr2_h)
  24. #define octave_tree_mvr2_h 1
  25.  
  26. #if defined (__GNUG__)
  27. #pragma interface
  28. #endif
  29.  
  30. class ostream;
  31.  
  32. class octave_value_list;
  33.  
  34. class tree_argument_list;
  35. class tree_identifier;
  36. class tree_index_expression;
  37. class tree_indirect_ref;
  38. class tree_return_list;
  39.  
  40. class tree_walker;
  41.  
  42. #include <string>
  43.  
  44. #include "ov.h"
  45. #include "pt-mvr-base.h"
  46. #include "oct-obj.h"
  47.  
  48. // Used internally.
  49.  
  50. class
  51. tree_oct_obj : public tree_multi_val_ret
  52. {
  53. public:
  54.  
  55.   tree_oct_obj (int l = -1, int c = -1) : tree_multi_val_ret (l, c) { }
  56.  
  57.   tree_oct_obj (const octave_value_list& v, int l = -1, int c = -1)
  58.     : tree_multi_val_ret (l, c), values (v) { }
  59.  
  60.   ~tree_oct_obj (void) { }
  61.  
  62.   octave_value eval (bool print);
  63.  
  64.   octave_value_list eval (bool print, int nargout,
  65.               const octave_value_list& args);
  66.  
  67.   void accept (tree_walker& tw);
  68.  
  69. private:
  70.  
  71.   const octave_value_list values;
  72. };
  73.  
  74. // Index expressions.
  75.  
  76. class
  77. tree_index_expression : public tree_multi_val_ret
  78. {
  79. public:
  80.  
  81.   tree_index_expression (int l = -1, int c = -1)
  82.     : tree_multi_val_ret (l, c), id (0), list (0) { }
  83.  
  84.   tree_index_expression (tree_identifier *i, int l = -1, int c = -1);
  85.  
  86.   tree_index_expression (tree_identifier *i, tree_argument_list *lst,
  87.              int l = -1, int c = -1);
  88.  
  89.   tree_index_expression (tree_indirect_ref *i, int l = -1, int c = -1)
  90.     : tree_multi_val_ret (l, c), id (i), list (0) { }
  91.  
  92.   tree_index_expression (tree_indirect_ref *i, tree_argument_list *lst,
  93.              int l = -1, int c = -1)
  94.     : tree_multi_val_ret (l, c), id (i), list (lst) { }
  95.  
  96.   ~tree_index_expression (void);
  97.  
  98.   bool is_index_expression (void) const
  99.     { return true; }
  100.  
  101.   tree_indirect_ref *ident (void)
  102.     { return id; }
  103.  
  104.   string name (void);
  105.  
  106.   tree_argument_list *arg_list (void)
  107.     { return list; }
  108.  
  109.   void mark_for_possible_ans_assign (void);
  110.  
  111.   octave_value eval (bool print);
  112.  
  113.   octave_value_list eval (bool print, int nargout, const octave_value_list& args);
  114.  
  115.   void eval_error (void);
  116.  
  117.   void accept (tree_walker& tw);
  118.  
  119. private:
  120.  
  121.   tree_indirect_ref *id;
  122.  
  123.   tree_argument_list *list;
  124. };
  125.  
  126. // Multi-valued assignment expressions.
  127.  
  128. class
  129. tree_multi_assignment_expression : public tree_multi_val_ret
  130. {
  131. public:
  132.  
  133.   tree_multi_assignment_expression (bool plhs = false, int l = -1, int c = -1)
  134.     : tree_multi_val_ret (l, c, tree_expression::multi_assignment),
  135.       preserve (plhs), lhs (0), rhs (0) { }
  136.  
  137.   tree_multi_assignment_expression (tree_return_list *lst,
  138.                     tree_multi_val_ret *r,
  139.                     bool plhs = false,
  140.                     int l = -1, int c = -1)
  141.     : tree_multi_val_ret (l, c, tree_expression::multi_assignment),
  142.       preserve (plhs), lhs (lst), rhs (r) { }
  143.  
  144.   ~tree_multi_assignment_expression (void);
  145.  
  146.   octave_value eval (bool print);
  147.  
  148.   octave_value_list eval (bool print, int nargout, const octave_value_list& args);
  149.  
  150.   bool is_assignment_expression (void) const
  151.     { return true; }
  152.  
  153.   void eval_error (void);
  154.  
  155.   tree_return_list *left_hand_side (void) { return lhs; }
  156.  
  157.   tree_multi_val_ret *right_hand_side (void) { return rhs; }
  158.  
  159.   void accept (tree_walker& tw);
  160.  
  161. private:
  162.  
  163.   bool preserve;
  164.   tree_return_list *lhs;
  165.   tree_multi_val_ret *rhs;
  166. };
  167.  
  168. #endif
  169.  
  170. /*
  171. ;;; Local Variables: ***
  172. ;;; mode: C++ ***
  173. ;;; End: ***
  174. */
  175.